package com.ym.controller.soso;

import com.github.pagehelper.PageInfo;
import com.ym.common.constant.Constants;
import com.ym.common.utils.page.PageDomain;
import com.ym.core.annotation.Log;
import com.ym.core.domain.APIResponse;
import com.ym.core.domain.BaseController;
import com.ym.soso.domain.entity.SveNurseComeEntity;
import com.ym.soso.domain.param.AppSveNurseComeQueryParam;
import com.ym.soso.domain.vo.AppSveNurseComeVO;
import com.ym.soso.service.ISveNurseComeSV;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * 护士上门Controller
 *
 * @author ym
 * @date 2020-03-06
 */
@Api(tags = "APP-护士上门")
@RestController("APPSveNurseComeController")
@Validated
@RequestMapping(value = "/soso/nurse/come", headers = Constants.Api.VERSION)
public class SveNurseComeController extends BaseController {

	@Autowired
	private ISveNurseComeSV sveNurseComeSV;

	@ApiOperation("查询护士上门列表")
	@Log(dataBase = false, printBody = false, printQuery = true)
	@GetMapping("/list")
	public APIResponse<PageInfo<AppSveNurseComeVO>> list(@Valid AppSveNurseComeQueryParam queryParam) {
		PageDomain.startPage();
		List<AppSveNurseComeVO> list = sveNurseComeSV.selectMobileList(queryParam);
		return successPage(list);
	}

	@ApiOperation("获取护士上门详细信息")
	@Log(dataBase = false, printBody = false, printQuery = true)
	@GetMapping(value = "/info")
	public APIResponse<SveNurseComeEntity> info(@RequestParam Long id) {
		SveNurseComeEntity data = sveNurseComeSV.selectById(id);
		return successData(data);
	}

}
